<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //1.利用RegExp对象创建   正则表达式
        var regexp = new RegExp(/tankunxin/);
        console.log(regexp);

        //利用字面量创建 正则表达式
        var rg = /tankunxin/;
        //test方法用来检测字符串是否符合正则表达式要求的规范
        console.log(rg.test(123));
        console.log(rg.test('tankunxin'));
    </script>
</body>
</html>